<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('补单')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-channelOrder-edit" th:object="${channelOrder}">
            <input id="orderId" name="orderId" th:field="*{orderId}"  type="hidden">
			<input id="businessId" name="businessId" th:field="*{businessId}"  type="hidden">
			<input id="channelUserId" name="channelUserId" th:field="*{channelUserId}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">平台订单号：</label>
				<div class="col-sm-8">
					<input id="ptOrderno" name="ptOrderno" th:field="*{ptOrderno}" class="form-control" type="text" disabled>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">下游订单号：</label>
				<div class="col-sm-8">
					<input id="childOrderno" name="childOrderno" th:field="*{childOrderno}" class="form-control" type="text" disabled>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">补单金额：</label>
				<div class="col-sm-8">
					<input name="amount"id="amount"  th:field="${channelOrder.amount}" class="form-control" type="number">
				</div>
			</div>

<!--			<div class="form-group">-->
<!--				<label class="col-sm-3 control-label"><span style="color: red; ">*</span>补单密码：</label>-->
<!--				<div class="col-sm-8">-->
<!--					<input id="password" name="password" class="form-control" type="password" required>-->
<!--				</div>-->
<!--			</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label"><span style="color: red; ">*</span>谷歌验证码：</label>
				<div class="col-sm-8">
					<input id="code" name="code" class="form-control" type="text" required placeholder="请输入谷歌验证码">
				</div>
			</div>
		</form>
		<div id="qrcode" style="margin-left: 38vw" ></div>
    </div>
    <div th:include="include::footer"></div>
	<script th:src="@{/js/md5.min.js}"></script>
	<script th:src="@{/js/pwdMd5.js}"></script>
	<script th:src="@{/js/qrcode.min.js}"></script>
    <script type="text/javascript">
		var redStr = '[[${channelOrder.submitUrl}]]'
		var qrcode = new QRCode(document.getElementById("qrcode"));
		qrcode.makeCode(redStr);
		$('#qrcode img').removeAttr('alt')

		var prefix = ctx + "channel/channelOrder";
		$("#form-channelOrder-edit").validate({
			rules:{
				amount:{
					required:true,
				},
				code:{
					required:true,
				},
				// password: {
				// 	required: true,
				// 	remote: {
				// 		url: ctx + "channel/channelUserInfo/checkPassword",
				// 		type: "get",
				// 		dataType: "json",
				// 		data: {
				// 			password: function () {
				// 				return md5($("input[name='password']").val());
				// 			}
				// 		}
				// 	}
				// },
			},
			messages: {
				password: "请输入正确的支付密码"
			},
			focusCleanup: true
		});
		
		function submitHandler() {
			var data = $("#form-channelOrder-edit").serializeArray();
			getMd5PwdByArray(data);
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", data);
	        }
	    }
	</script>
</body>
</html>
